class Solution {
public:
    string destCity(vector<vector<string>>& paths)
    {
        vector<string> ans;
        unordered_map<string, int> hash;
        for (auto e : paths)
        {
            hash[e[0]]++;
            hash[e[1]]++;
            if (hash[e[1]] == 1)
                ans.push_back(e[1]);
        }
        int i;
        for (i = 0; i < ans.size(); i++)
            if (hash[ans[i]] == 1)
                break;
        return ans[i];
    }
};